<template>
  <div id="app-container">
    <el-table
      :data="items"
      stripe
      style="width: 100%">
      <el-table-column
        type="index"
        width="50"/>
      <el-table-column
        prop="name"
        label="讲师姓名"
        width="180"/>
      <el-table-column
        prop="intro"
        label="简介"/>
      <el-table-column
        prop="level"
        label="级别"
        width="70">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.level === 1" type="success" size="mini">高级讲师</el-tag>
          <el-tag v-if="scope.row.level === 2" size="mini">首席讲师</el-tag>
        </template>
      </el-table-column>
      <el-table-column
        prop="joinDate"
        label="加入时间"
        width="100"/>
      <el-table-column
        prop="sort"
        label="排序"
        width="60"/>
    </el-table>
  </div>
</template>
<script>
import teacherApi from '@/api/teacher'
export default {
  // 编写vue语法的内容
  data() {
    return {
      items: []
    }
  },
  created() {
    this.getTeacherList()
  },
  mounted() {

  },
  methods: {
    getTeacherList() {
      teacherApi.teacherList().then(response => {
        // console.log(response.data.items)
        this.items = response.data.items
      })
    }
  }
}
</script>
